package com.yao.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * User: 姚宏武
 * Date: 2017/11/23
 * Time: 10:40
 * Email：401369870@qq.com
 * Description: json工具类
 */
public class JsonUtil {
    /**
     * 对象转换成json
     * @param object
     * @return
     */
    public static String toJson(Object object) {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);
    }
}
